www.mxdraw.com
内容索引主面
前一个向上下一个
IMxDrawSelectionSet::SelectByPolygon 方法

在多个点组合的闭合区域里,构造选择集.

IDL
[helpstring("method SelectByPolygon")]
HRESULT SelectByPolygon([in] MCAD_McSelect mode, [in] IMxDrawPoints* points, [in,defaultvalue(NULL)] IMxDrawResbuf* filterData);
参数 
说明 
[in] IMxDrawPoints* points 
组成闭合区域的点集合 
[in,defaultvalue(NULL)] IMxDrawResbuf* filterData 
过滤条件 
Mode 
构造选择集方式 

例如: C#

                MxDrawUtility mxUtility = new MxDrawUtility();
                MxDrawPoints points = new MxDrawPoints();
                while (true)
                {
            

                    MxDrawPoint point = null;
                    if(points.Count  == 0)
                        point = (MxDrawPoint)(mxUtility.GetPoint(null, "点取点:"));
                    else
                        point = (MxDrawPoint)(mxUtility.GetPoint(points.Item(points.Count -1), "点取下一点:"));

                    if (point == null)
                    {
                        break;
                    }

                    points.Add(point.x, point.y, point.z);
                }

                if (points.Count < 3)
                    return;


                MxDrawSelectionSet sel = new MxDrawSelectionSet();
                sel.SelectByPolygon(MCAD_McSelect.mcSelectionSetCrossingPolygon,points,null);
                if (sel.Count == 0)
                {
                    MessageBox.Show("没有选择任何实体");
                    return;
                }

         
                // 遍历选择集,得到实体。

                for (int i = 0; i < sel.Count; i++)
                {
                    MxDrawEntity ent = sel.Item(i);

                    mxUtility.Prompt(ent.ObjectName);
                    mxUtility.Prompt("n");
                }
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!